package net.zm123.sync;

import com.nfk.grpc.MyServiceGrpc;
import com.nfk.grpc.MyServiceOuterClass;
import io.grpc.ManagedChannel;

public class RpcSyncClient {
    private MyServiceGrpc.MyServiceBlockingStub blockingStub;

    public RpcSyncClient(ManagedChannel channel) {
        this.blockingStub = MyServiceGrpc.newBlockingStub(channel);
    }

    public void testActionMethod() {
        MyServiceOuterClass.ActionRequest request = MyServiceOuterClass.ActionRequest.newBuilder()
                //todo
                .setTerminalId("test")
                .setThreshold(123)
                .build();
        MyServiceOuterClass.ActionResponse response = this.blockingStub.actionMethod(request);
        if (response != null) {
            String message = response.getMessage();
            System.out.println(message);
        }
    }
}
